
package nav;

import java.util.Collection;
import java.util.HashMap;

public class CrossingCollectionImpl implements ICollection{

	
	private HashMap<Integer, CrossingTopologyObjectImpl> crossings = new HashMap<Integer, CrossingTopologyObjectImpl>();
	
    public CrossingCollectionImpl(){

    }

    public void add(Object o) {
    	CrossingTopologyObjectImpl d=(CrossingTopologyObjectImpl)o;
    	crossings.put(d.getID(), d);
    }

    public void read(String source) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public String write() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    

    public CrossingTopologyObjectImpl get(int id){
    	return crossings.get(id);
    }
    
    public boolean exists(int id){
    	if (crossings.containsKey(id))
    		return true;
    	else
    		return false;
    	
    }
    
	public Collection<CrossingTopologyObjectImpl> getAll(){
		return crossings.values();
	}
}
